package com.cloudbroker.bcs.platform.dav.middle.model;

import org.apache.commons.lang3.StringUtils;

import com.alibaba.fastjson.JSON;
import com.cloudbroker.bcs.common.model.SessionIdentity;
import com.cloudbroker.bcs.platform.dav.middle.entity.Broker;
import com.cloudbroker.bcs.platform.dav.middle.entity.Customer;

public class CustomerCache extends SessionIdentity {
    
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;
    
    private Customer customer;
    
    private Broker broker;
    
    private Long userCenterId;
    
    private String invitationCode;
    
    public static CustomerCache fromStringInfo(String string) {
        if (StringUtils.isNotBlank(string)) {
            return JSON.parseObject(string, CustomerCache.class);
        }
        return null;
    }
    
    public Customer getCustomer() {
        return customer;
    }
    
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }
    
    public Broker getBroker() {
        return broker;
    }
    
    public void setBroker(Broker broker) {
        this.broker = broker;
    }
    
    public String getInvitationCode() {
        return invitationCode;
    }
    
    public void setInvitationCode(String invitationCode) {
        this.invitationCode = invitationCode;
    }
    
    public Long getUserCenterId() {
        return userCenterId;
    }
    
    public void setUserCenterId(Long userCenterId) {
        this.userCenterId = userCenterId;
    }
    
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("CustomerCache [customer=").append(customer).append(", broker=").append(broker)
                .append(", userCenterId=").append(userCenterId).append(", invitationCode=").append(invitationCode)
                .append(", client_id=").append(client_id).append(", brokerId=").append(brokerId)
                .append(", userType=").append(userType).append(", platformType=").append(platformType)
                .append(", permissions=").append(permissions).append(", brokerLoginType=").append(brokerLoginType)
                .append("]");
        return builder.toString();
    }
    
}
